.class public Llt/noframe/gpsfarmguide/LocationTracking;
.super Ljava/lang/Object;
.source "LocationTracking.java"


# static fields
.field static animating:Z = false


# direct methods
.method public static centerMyPosition(Landroid/content/Context;ZZZ)Z
    .locals 7

    .line 29
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object v0

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/Data;->getLastLocation()Landroid/location/Location;

    move-result-object v0

    if-nez v0, :cond_1

    if-eqz p2, :cond_0

    const p1, 0x7f110131

    .line 33
    invoke-virtual {p0, p1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object p1

    invoke-static {p0, p1}, Llt/noframe/gpsfarmguide/widgets/MegaToast;->showTextShort(Landroid/content/Context;Ljava/lang/String;)Llt/noframe/gpsfarmguide/widgets/MegaToast;

    :cond_0
    const/4 p0, 0x0

    return p0

    .line 36
    :cond_1
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object p2

    invoke-virtual {p2}, Llt/noframe/gpsfarmguide/Data;->getMap()Lcom/google/android/gms/maps/GoogleMap;

    move-result-object p2

    invoke-virtual {p2}, Lcom/google/android/gms/maps/GoogleMap;->getCameraPosition()Lcom/google/android/gms/maps/model/CameraPosition;

    move-result-object p2

    .line 37
    iget v1, p2, Lcom/google/android/gms/maps/model/CameraPosition;->zoom:F

    if-eqz p1, :cond_2

    const/high16 p1, 0x41880000    # 17.0f

    cmpg-float v2, v1, p1

    if-gez v2, :cond_2

    const/high16 v1, 0x41880000    # 17.0f

    .line 42
    :cond_2
    new-instance p1, Lcom/google/android/gms/maps/model/CameraPosition$Builder;

    invoke-direct {p1}, Lcom/google/android/gms/maps/model/CameraPosition$Builder;-><init>()V

    new-instance v2, Lcom/google/android/gms/maps/model/LatLng;

    .line 43
    invoke-virtual {v0}, Landroid/location/Location;->getLatitude()D

    move-result-wide v3

    invoke-virtual {v0}, Landroid/location/Location;->getLongitude()D

    move-result-wide v5

    invoke-direct {v2, v3, v4, v5, v6}, Lcom/google/android/gms/maps/model/LatLng;-><init>(DD)V

    invoke-virtual {p1, v2}, Lcom/google/android/gms/maps/model/CameraPosition$Builder;->target(Lcom/google/android/gms/maps/model/LatLng;)Lcom/google/android/gms/maps/model/CameraPosition$Builder;

    iget v0, p2, Lcom/google/android/gms/maps/model/CameraPosition;->bearing:F

    .line 44
    invoke-virtual {p1, v0}, Lcom/google/android/gms/maps/model/CameraPosition$Builder;->bearing(F)Lcom/google/android/gms/maps/model/CameraPosition$Builder;

    .line 45
    invoke-virtual {p1, v1}, Lcom/google/android/gms/maps/model/CameraPosition$Builder;->zoom(F)Lcom/google/android/gms/maps/model/CameraPosition$Builder;

    iget p2, p2, Lcom/google/android/gms/maps/model/CameraPosition;->tilt:F

    .line 46
    invoke-virtual {p1, p2}, Lcom/google/android/gms/maps/model/CameraPosition$Builder;->tilt(F)Lcom/google/android/gms/maps/model/CameraPosition$Builder;

    .line 47
    invoke-virtual {p1}, Lcom/google/android/gms/maps/model/CameraPosition$Builder;->build()Lcom/google/android/gms/maps/model/CameraPosition;

    move-result-object p1

    if-eqz p3, :cond_3

    .line 51
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object p2

    invoke-virtual {p2}, Llt/noframe/gpsfarmguide/Data;->getMapStatesController()Llt/noframe/gpsfarmguide/states/map_states/MapStatesController;

    move-result-object p2

    invoke-virtual {p2}, Llt/noframe/gpsfarmguide/states/map_states/MapStatesController;->getCenter()Landroid/widget/ImageButton;

    move-result-object p2

    const v0, 0x7f0800fb

    invoke-virtual {p2, v0}, Landroid/widget/ImageButton;->setImageResource(I)V

    :cond_3
    const/4 p2, 0x1

    .line 54
    sput-boolean p2, Llt/noframe/gpsfarmguide/LocationTracking;->animating:Z

    .line 55
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object v0

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/Data;->getMap()Lcom/google/android/gms/maps/GoogleMap;

    move-result-object v0

    invoke-static {p1}, Lcom/google/android/gms/maps/CameraUpdateFactory;->newCameraPosition(Lcom/google/android/gms/maps/model/CameraPosition;)Lcom/google/android/gms/maps/CameraUpdate;

    move-result-object p1

    new-instance v1, Llt/noframe/gpsfarmguide/LocationTracking$1;

    invoke-direct {v1, p3, p0}, Llt/noframe/gpsfarmguide/LocationTracking$1;-><init>(ZLandroid/content/Context;)V

    invoke-virtual {v0, p1, v1}, Lcom/google/android/gms/maps/GoogleMap;->animateCamera(Lcom/google/android/gms/maps/CameraUpdate;Lcom/google/android/gms/maps/GoogleMap$CancelableCallback;)V

    return p2
.end method

.method public static setMapFolowings(Landroid/content/Context;)V
    .locals 3

    .line 78
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object v0

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/Data;->isFolowing()Z

    move-result v0

    const/4 v1, 0x0

    const/4 v2, 0x1

    if-nez v0, :cond_2

    invoke-static {p0, v2, v2, v1}, Llt/noframe/gpsfarmguide/LocationTracking;->centerMyPosition(Landroid/content/Context;ZZZ)Z

    move-result v0

    if-nez v0, :cond_0

    goto :goto_0

    .line 82
    :cond_0
    invoke-static {p0, v2, v2, v1}, Llt/noframe/gpsfarmguide/LocationTracking;->centerMyPosition(Landroid/content/Context;ZZZ)Z

    move-result v0

    if-nez v0, :cond_1

    .line 84
    invoke-static {p0}, Llt/noframe/gpsfarmguide/LocationTracking;->setMapNotFollowing(Landroid/content/Context;)V

    return-void

    .line 88
    :cond_1
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object p0

    invoke-virtual {p0, v2}, Llt/noframe/gpsfarmguide/Data;->setFolowing(Z)V

    .line 89
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object p0

    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/Data;->getMapStatesController()Llt/noframe/gpsfarmguide/states/map_states/MapStatesController;

    move-result-object p0

    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/states/map_states/MapStatesController;->getCenter()Landroid/widget/ImageButton;

    move-result-object p0

    const v0, 0x7f0800fb

    invoke-virtual {p0, v0}, Landroid/widget/ImageButton;->setImageResource(I)V

    .line 90
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object p0

    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/Data;->getMap()Lcom/google/android/gms/maps/GoogleMap;

    move-result-object p0

    new-instance v0, Llt/noframe/gpsfarmguide/LocationTracking$2;

    invoke-direct {v0}, Llt/noframe/gpsfarmguide/LocationTracking$2;-><init>()V

    invoke-virtual {p0, v0}, Lcom/google/android/gms/maps/GoogleMap;->setOnMyLocationChangeListener(Lcom/google/android/gms/maps/GoogleMap$OnMyLocationChangeListener;)V

    return-void

    .line 79
    :cond_2
    :goto_0
    invoke-static {p0, v2, v1, v1}, Llt/noframe/gpsfarmguide/LocationTracking;->centerMyPosition(Landroid/content/Context;ZZZ)Z

    return-void
.end method

.method public static setMapNotFollowing(Landroid/content/Context;)V
    .locals 1

    .line 120
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object p0

    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/Data;->isFolowing()Z

    move-result p0

    if-nez p0, :cond_0

    return-void

    .line 123
    :cond_0
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object p0

    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Llt/noframe/gpsfarmguide/Data;->setFolowing(Z)V

    .line 124
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object p0

    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/Data;->getMap()Lcom/google/android/gms/maps/GoogleMap;

    move-result-object p0

    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/google/android/gms/maps/GoogleMap;->setOnMyLocationChangeListener(Lcom/google/android/gms/maps/GoogleMap$OnMyLocationChangeListener;)V

    .line 125
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object p0

    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/Data;->getMapStatesController()Llt/noframe/gpsfarmguide/states/map_states/MapStatesController;

    move-result-object p0

    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/states/map_states/MapStatesController;->getCenter()Landroid/widget/ImageButton;

    move-result-object p0

    const v0, 0x7f0800fc

    invoke-virtual {p0, v0}, Landroid/widget/ImageButton;->setImageResource(I)V

    return-void
.end method
